<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // 创建一个ajax对象
    let xhr = new XMLHttpRequest()
    //设置ajax请求参数，请求方式，请求地址
    xhr.open('get', url)
    //设置ajax回调函数
    xhr.onreadystatechange = function () {
        // 判断请求状态是否等于4
        if (xhr.readyState == 4) {
            console.log(JSON.parse(xhr.responseText));
        }
    }
    //发送请求
    xhr.send()
</script>